﻿using System;
using UnityEngine;

// Token: 0x0200030B RID: 779
[ExecuteInEditMode]
public class AutoConfigureNPC : MonoBehaviour
{
	// Token: 0x060013B6 RID: 5046 RVA: 0x00083C24 File Offset: 0x00081E24
	private void Start()
	{
		this.rigid = base.gameObject.GetComponent<Rigidbody>();
		this.colisionador = base.gameObject.GetComponent<CapsuleCollider>();
		this.controller = base.gameObject.GetComponent<MicroNPC>();
		this.anim = base.gameObject.GetComponent<Animator>();
		if (this.rigid == null)
		{
			this.rigid = base.gameObject.AddComponent<Rigidbody>();
		}
		if (this.colisionador == null)
		{
			this.colisionador = base.gameObject.AddComponent<CapsuleCollider>();
		}
		if (this.controller == null)
		{
			this.controller = base.gameObject.AddComponent<MicroNPC>();
		}
		base.gameObject.layer = LayerMask.NameToLayer("NPC");
	}

	// Token: 0x060013B7 RID: 5047 RVA: 0x00083CF0 File Offset: 0x00081EF0
	private void Update()
	{
		this.colisionador.height = this.height;
		this.colisionador.center = new Vector3(0f, this.height / 2f, 0f);
		this.colisionador.radius = this.radius;
		this.rigid.constraints = RigidbodyConstraints.FreezeRotation;
		RuntimeAnimatorController microAnimatorController = IOManager.Instance.microAnimatorController;
		AnimationManager.SetAnimatorController(this.anim, microAnimatorController);
	}

	// Token: 0x04001700 RID: 5888
	public float height = 1.7f;

	// Token: 0x04001701 RID: 5889
	public float radius = 0.2f;

	// Token: 0x04001702 RID: 5890
	private CapsuleCollider colisionador;

	// Token: 0x04001703 RID: 5891
	private Rigidbody rigid;

	// Token: 0x04001704 RID: 5892
	private MicroNPC controller;

	// Token: 0x04001705 RID: 5893
	private Animator anim;
}
